package com.kust.smarthome.web.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kust.smarthome.web.mapper.CurtainMapper;
import com.kust.smarthome.web.model.Curtain;
import com.kust.smarthome.web.service.ICurtainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author iAuzre
 * @since 2021-06-28
 */
@Service
public class CurtainServiceImpl extends ServiceImpl<CurtainMapper, Curtain> implements ICurtainService {

    @Autowired
    private CurtainMapper curtainMapper;

    @Override
    public int insert(Curtain curtain) {
        return curtainMapper.insert(curtain);
    }

    @Override
    public List<Curtain> getByUserId(Integer userId) {
        QueryWrapper<Curtain> query = new QueryWrapper<>();
        query.eq("user_id",userId);
        return curtainMapper.selectList(query);
    }
}
